function initDialog() {
    document.
	getElementById("words-iframe").
	setAttribute("src", 
		     "http://dict.cn/mini.php?q=" + 
		     window.arguments[0].inn.selection);
    document.
	getElementById("concepts-iframe").
	setAttribute("src", 
		     "http://en.m.wikipedia.org/wiki/" + 
		     window.arguments[0].inn.selection);
}

function getServerUrl() {
    if (document.getElementById("search-tabbox").selectedIndex == 0)
	return "http://localhost:8080/demo/hackernerd.php";
    else
	return "http://localhost:8888/upload";
}

function onAccept() {
    var url = getServerUrl();
    var xhr = new XMLHttpRequest();
    xhr.open('POST', url, true);
    xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
    xhr.onload = function () {
	// do something to response
	console.log(this.responseText);
    };
    xhr.send('word='+window.arguments[0].inn.selection);
}

